<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>手机商城</title>
<!-- CSS -->
<link rel="stylesheet" href="{url:#css/materialize.min.css}" />
<link rel="stylesheet" href="{url:#css/me.css}" />
<link rel="stylesheet" href="{url:#css/iconfont.css}" />

<style type="text/css">
.btn {
  display: inline-block;
  margin-bottom: 0;
  font-weight: normal;
  text-align: center;
  vertical-align: middle;
  touch-action: manipulation;
  cursor: pointer;
  background-image: none;
  border: 1px solid transparent;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.42857;
  border-radius: 3px; 
  }
  .btn:hover{
  	background-color:#c71f1f;
  }
  .btn-main 
  {
	  color: #FFF;
	  background-color: #dd2727;
	  border-color: #c71f1f; 
  }
/**去除绿色下划线 - 开始*/
input::-webkit-input-placeholder {
    color: #7e7e7e;
    text-indent: 5px;
}
input:not([type]),input[type=text],input[type=password],input[type=email],input[type=url],input[type=time],input[type=date],input[type=datetime-local],input[type=tel],input[type=number],input[type=search],textarea.materialize-textarea{background-color:transparent;border:none;border-radius:0;outline:none;height:1.5em;width:100%;font-size:1rem;margin:0;padding:0;box-shadow:none;}
input:not([type]):focus:not([readonly]),input[type=text]:focus:not([readonly]),input[type=password]:focus:not([readonly]),input[type=email]:focus:not([readonly]),input[type=url]:focus:not([readonly]),input[type=time]:focus:not([readonly]),input[type=date]:focus:not([readonly]),input[type=datetime-local]:focus:not([readonly]),input[type=tel]:focus:not([readonly]),input[type=number]:focus:not([readonly]),input[type=search]:focus:not([readonly]),textarea.materialize-textarea:focus:not([readonly]){border-bottom:none;box-shadow:none}
/**去除绿色下划线 - 结束*/

/*开始*/
.q-body
{
	background-color:#fff;
}
.q-reg-box
{
	border:none;
}
.q-hut
{
	font-family:"微软雅黑";
	font-size:16px;
	color:#F00;
}
.q-hult
{
	text-align:right;
}
.q-kru
{
	padding:0px 5px;
}
.q-rltitle
{
	width:90px;
	text-align:center;
}
</style>
<!-- JS -->
<script src="{url:#js/jquery-1.11.3.min.js}"></script>
<script src="{url:#js/materialize.min.js}"></script>
<script src="{url:#js/home/register.js}"></script>
<script src="{url:#js/yang_check.js}"></script>


</head>
<body class="q-body">
<!-- TitleBar 开始 -->
<div class="navbar-fixed">
  <nav>
    <div class="nav-wrapper red accent-4 valign-wrapper">
      <ul class="left" id="nav-btn-left">
        <li><a><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
      <span class="title-bar-size center_align">币种转换</span>
      <ul class="right">
        <li><a  class="disabled" style="visibility:hidden"><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
    </div>
  </nav>
</div>
<!-- TitleBar 结束 -->

<div class="container">
	<div class="q-reg-box">
	<table>
		<tr>
			<td class="q-rltitle">现金币</td>
			<td class="q-hult"><span class="q-hut">{$mobile_user['balance']|'0.00'}</span>&nbsp;&nbsp;元</td>
		</tr>
		<tr><td colspan="2" class="q-kru"><div class="divider"></div></td></tr>
		<tr>
			<td class="q-rltitle">借款币</td>
			<td class="q-hult"><span class="q-hut">{$mobile_user['jkb']|'0.00'}</span>&nbsp;&nbsp;元</td>
		</tr>
		<tr>
			<td colspan="2"  class="q-kru"><div class="divider"></div></td>
		</tr>
		<tr>
			<td class="q-rltitle">购物币</td>
			<td class="q-hult"><span class="q-hut">{$mobile_user['gwb']|'0.00'}</span>&nbsp;&nbsp;元</td>
		</tr>
		<tr><td colspan="2" class="q-kru"><div class="divider"></div></td></tr>
		<tr>
			<td class="q-rltitle">重消币</td>
			<td class="q-hult"><span class="q-hut">{$mobile_user['u_cx']|'0.00'}</span>&nbsp;&nbsp;元</td>
		</tr>
		<tr>
			<td colspan="2"  class="q-kru"><div class="divider"></div></td>
		</tr>
		<tr>
			<td class="q-rltitle">信用币</td>
			<td class="q-hult"><span class="q-hut">{$mobile_user['xyb']|'0.00'}</span>&nbsp;&nbsp;元</td>
		</tr>
		<tr><td colspan="2" class="q-kru"><div class="divider"></div></td></tr>
		<tr>
			<td class="q-rltitle">学习币</td>
			<td class="q-hult"><span class="q-hut">{$mobile_user['xxb']|'0.00'}</span>&nbsp;&nbsp;元</td>
		</tr>
		
		<tr>
			<td colspan="2"  class="q-kru"><div class="divider"></div></td>
		</tr>
	</table>
	<table>
		<tr>
			<td>转换方式</td>
			<td>
				<select style="display:block;" name='zh_from' id="zh_from">
					<option value='balance'>现金币</option>
					<option value='jkb'>借款币</option>
					<option value='u_cx'>重消币</option>
				</select>
			</td>
		</tr>
		<tr >
			<td style="padding:5px;">&nbsp;</td>
			<td style="text-align:center;font-size:25px;padding:5px;">
				<b>↓</b>
			</td>
		</tr>
		<tr>
			<td style="padding-top:5px;">&nbsp;</td>
			<td style="padding-top:5px;">
				<select style="display:block;" name='zh_to' id="zh_get">
					<option value='gwb'>购物币</option>
					<option value='xyb'>信用币</option>
					<option value='xxb'>学习币</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>&nbsp;&nbsp;</td>
			<td>
				<span style="color:red;">转学习币为1：2      转购物币为1：3</span>
			</td>
		</tr>
		<tr>
			<td>转换金额</td>
			<td>
				<input type="text" style="display:block;border:1px solid rgb(209,219,205); width:100%; height:35px; font-size:16px; line-height:1.6;" name="amount" id="amount"/>
			</td>
		</tr>
		<tr>
			<td>二级密码</td>
			<td>
				<input type="password" style="display:block;border:1px solid rgb(209,219,205); width:100%; height:35px; font-size:16px; line-height:1.6;" name="pass2" id="pass2"/>
			</td>
		</tr>
		<tr>
			<td colspan='2' style='text-align:center;'>
				<input type="hidden" name='user_id' id='user_id' value='{$mobile_user["id"]}'/>
				<a id="a_sub_trans" class='btn btn-main' onclick="a_sub_trans()">开始转换</a>
			</td>
			
		</tr>
	</table>
	
	</div>
</div>
<script type="text/javascript">
function a_sub_trans()
{
	var user_id = $("#user_id").val();
	var zh_from = $("#zh_from").val();
	var zh_get   = $("#zh_get").val();
	var amount  = $("#amount").val();
	var pass2   = $("#pass2").val();

	if( isNaN(amount) || amount == '' || amount <= 0 )
	{
		yang_alert('金额必须为数字且必须大于0');
		return;
	}

	if( pass2 == '' )
	{
		yang_alert('二级密码不能为空');
		return;
	}

	$("#a_sub_trans").removeAttr('onclick');
	
	$.post('{url:/mobile/trans_do}',{user_id:user_id,amount:amount,zh_from:zh_from,zh_get:zh_get,pass2:pass2},function(data){
        if( data['status']=='success' )
	    {
		    yang_alert('操作成功');
		    //个人中心页面
            document.location.href="{url:/mobile/trans}";
        }
        else
	    {
            yang_alert(data['msg']);
            document.location.href="{url:/mobile/trans}";
        }
      },'json');
}

</script>

</body>
</html>
